/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author YDZ
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';

const { adminPath } = useGlobSetting();

export interface SoAdvanceOrder extends BasicModel<SoAdvanceOrder> {
  code?: string; // 订单号
  cusCode?: string; // 客户编码
  invCode?: string; // 存货编码
  hfmdCode?: string; // 核发门店编码
  cxMoney?: number; // 使用促销金额
  flMoney?: number; // 使用返利金额
  croute?: string; // 协同路线
  iquantity?: number; // 数量
  inum?: number; // 件数
  salePrice?: number; // 单价
  isum?: number; // 金额
  soAdvanceOrderChildList?: any[]; // 子表列表
}

export const soAdvanceOrderList = (params?: SoAdvanceOrder | any) =>
  defHttp.get<SoAdvanceOrder>({ url: adminPath + '/shop/order/soAdvanceOrder/list', params });

export const soAdvanceOrderListData = (params?: SoAdvanceOrder | any) =>
  defHttp.post<Page<SoAdvanceOrder>>({ url: adminPath + '/shop/order/soAdvanceOrder/listData', params });

export const soAdvanceOrderForm = (params?: SoAdvanceOrder | any) =>
  defHttp.get<SoAdvanceOrder>({ url: adminPath + '/shop/order/soAdvanceOrder/form', params });

export const soAdvanceOrderSave = (params?: any, data?: SoAdvanceOrder | any) =>
  defHttp.postJson<SoAdvanceOrder>({ url: adminPath + '/shop/order/soAdvanceOrder/save', params, data });

export const soAdvanceOrderDelete = (params?: SoAdvanceOrder | any) =>
  defHttp.get<SoAdvanceOrder>({ url: adminPath + '/shop/order/soAdvanceOrder/delete', params });

  export const orderSettleForm = (params?: SoAdvanceOrder | any) =>
  defHttp.get<SoAdvanceOrder>({ url: adminPath + '/shop/order/soAdvanceOrder/orderSettleForm', params });

  export const saveFromAdvanceOrder = (params?: any, data?: SoAdvanceOrder | any) =>
  defHttp.postJson<SoAdvanceOrder>({ url: adminPath + '/shop/order/soAdvanceOrder/saveFromAdvanceOrder', params, data });

  export const getSelectCurCus = (params?: SoAdvanceOrder | any) =>
  defHttp.post<Page<SoAdvanceOrder>>({ url: adminPath + '/shop/api/getSelectCurCus', params });

  export const findSelectMnCusListData = (params?: SoAdvanceOrder | any) =>
  defHttp.get<SoAdvanceOrder>({ url: adminPath + '/shop/api/treeData', params });

export const addressListData = (params?: SoAdvanceOrder | any) =>
    defHttp.get<SoAdvanceOrder>({ url: adminPath + '/bas/cus/address/listData', params });